#include <bits/stdc++.h>
#include "trie.h"
#include "hush.h"
#include "avl.h"
using namespace std;

int main(int argc, char** argv) {
	freopen("C:\\Users\\86156\\Desktop\\2.txt", "r", stdin);
	Hush test;
	for(int CASE = 1; CASE <= 100000; CASE++) {
		int op;
		cin >> op;
		//op == 1 -> insert, op == 2 -> delete, op == 3 -> search
		if(op == 1) {
			string a, b;
			cin >> a >> b;
			test.insert(a, b);
		} else if(op == 2) {
			string a;
			cin >> a;
			test.deleteKey(a);
		} else {
			string a;
			cin >> a;
			cout << test.find(a) << '\n';
		}
	} 
	return 0;
}
